#!/bin/env python

import time
import cv2
import numpy as np

pic_path = "../resource/pic/img_001.jpg"
windowName = pic_path

pic1 = cv2.imread(pic_path)
pic1_h, pic1_w, pic1_chn = pic1.shape

# 方盒滤波
img = cv2.boxFilter(pic1, -1, (5, 5), normalize=True)

# 均值滤波(模糊)
img2 = cv2.blur(pic1, (5, 5))

# 高斯模糊
img3 = cv2.GaussianBlur(pic1, (5, 5), sigmaX=1.5)

# 中值滤波
img4 = cv2.medianBlur(pic1, 5)

cv2.namedWindow(windowName, cv2.WINDOW_NORMAL)
cv2.resizeWindow(windowName, 2500, 500)
cv2.imshow(windowName, np.hstack((pic1, img, img2, img3, img4)))

pic2 = cv2.imread("../resource/pic/img_005.jpg")
img5 = cv2.bilateralFilter(pic2, 5, sigmaColor=10, sigmaSpace=20)

cv2.namedWindow("windowName2", cv2.WINDOW_NORMAL)
cv2.resizeWindow("windowName2", 2500, 500)
cv2.imshow("windowName2", np.hstack((pic2, img5)))

while True:
    if cv2.waitKey(0) == ord('q'):
        break

print('销毁窗口')
cv2.destroyAllWindows()


